{extend name="public:common_edit"/}
{block name="main"}

<style>
    .tipStyle {
        display: none;
        position: absolute;
        background-color: #FBEC88;
        font-size: 16px;
        border-right: #D0EAF9 solid 1px;
        border-bottom: #D0EAF9 solid 1px;
        border-left: #D0EAF9 solid 1px;
        border-top: #D0EAF9 solid 1px;
    }

</style>

<div id="kyqToolTip" class="tipStyle"></div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-list"></i>敏感词列表</h3>
        </div>
        <div class="panel-body">

            <div class="navbar navbar-default">
                <form action="" id="search-form2" class="navbar-form form-inline" method="get" onsubmit="return false">
                    <label class="control-label">
                        <span style="color: red">&nbsp;ps:融云默认最多设置 50 个敏感词， 设置 2 小时后生效 目前仅支持文本消息</span> </label>


                    <a onclick="add()" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加</a>

                </form>
            </div>
            <div id="ajax_return">
                <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <td>序号</td>
                                <td>类型</td>
                                <td>关键词</td>
                                <td>替换内容</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- 列表循环开始 -->
                            {volist name="rows" id="row" key="key"}
                            <tr>
                                <td>{$key}</td>

                                <td>{if condition="$row.type == 1"} 敏感词屏蔽 {else /} 敏感词替换 {/if}</td>
                                <td>{$row.word}</td>
                                <td>{$row.replaceWord}</td>
                                <td>

                                    <span class="btn btn-danger check_del" data-message="" data-url="{:url('del',['keyword'=>$row.word])}">删除</span>
                                </td>
                            </tr>
                            {/volist}
                            <!-- 列表循环结束 -->
                            </tbody>
                        </table>
                    </div>
                </form>
            </div>
            <div class="modal fade" id="bjy-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
                            <h4 class="modal-title" id="myModalLabel">添加敏感词</h4></div>
                        <div class="modal-body">
                            <form id="bjy-form" class="form-inline" action="{:url('system/add')}" method="post"><input
                                    type="hidden" name="pid" value="0">
                                <table class="table table-striped table-bordered table-hover table-condensed">
                                    <tr>
                                        <th>敏感词：</th>
                                        <td><input class="form-control" type="text" name="keyword"></td>
                                    </tr>
                                    <tr>
                                        <th>类型：</th>
                                        <td>
                                            <select class="form-control" name="type">
                                                <option value="0">敏感词替换</option>
                                                <option value="1">敏感词屏蔽</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>敏感词替换内容：</th>
                                        <td><input class="form-control" type="text" name="replace"></td>
                                    </tr>
                                    <tr>
                                        <th></th>
                                        <td><input class="btn btn-success submit" type="submit" value="发布"></td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div id='pagerarea'>{$pageHTML}</div>
        </div>
    </div>
{/block}
{block name="js"}

<script src="__JS__/boxImg.js" type="text/javascript" ></script>
<link rel="stylesheet" type="text/css" href="__CSS__/boxImg.css">


<script>


    function openUri(uri) {
        layer.open({
            type: 2,
            title: '用户信息编辑',
            shadeClose: true,
            shade: 0.8,
            area: ['90%', '90%'],
            content:uri //iframe的url
        });
    }


    var pointX;
    var pointY;

    $('.success').click(function () {
        var _that = $(this);

        layer.prompt({title: '封禁时间(小时 0为永久封禁)', formType: 0}, function(pass, index){
            layer.close(index);
            var url = $($(_that).next('.change')).data('url');
            url += '?end_time='+pass;
            $($(_that).next('.change')).data('url',url);
            $($(_that).next('.change')).click();
        });



    });

    function showTip(str){

        if(str.length > 0){
            $("#kyqToolTip").css("display","block");
            $("#kyqToolTip").css("left",pointX+10);
            $("#kyqToolTip").css("top",pointY-10);
            $("#kyqToolTip").html(str);
        }
    }

    // 添加菜单
    $(".txtstyle").bind("mouseover",function(e){
        pointX = e.pageX;
        pointY = e.pageY;
        var html = $(this).data('str');
        html = jEmoji.softbankToUnified(html);
        html = jEmoji.googleToUnified(html);
        html = jEmoji.docomoToUnified(html);
        html = jEmoji.kddiToUnified(html);
        showTip(jEmoji.unifiedToHTML(html));
    }).bind("mouseout",function(e){
        closeTip()
    }).bind("mousedown",function(e){
        closeTip()
    });

    function closeTip() {
        $("#kyqToolTip").css("display","none");
    }


    var status   = "{$Think.get.status}";
    if(status != ''){
        $('#status'+status).attr('selected',true)
    }

    var sex   = "{$Think.get.sex}";
    if(sex != ''){
        $('#sex'+sex).attr('selected',true)
    }
    function add() {
        $("input[name='title'],input[name='name']").val('');
        $("input[name='pid']").val(0);
        $('#bjy-add').modal('show');
    }

    function customer() {
        $("input[name='title'],input[name='url'],input[name='user_id']").val('');
        $('#customer').modal('show');
    }


    $(function () {

        $.each($('.emojstext'),function (k,v) {
            var $text = $(v);
            var html = $text.html().trim().replace(/\n/g, '<br/>');
            html = jEmoji.softbankToUnified(html);
            html = jEmoji.googleToUnified(html);
            html = jEmoji.docomoToUnified(html);
            html = jEmoji.kddiToUnified(html);
            $text.html(jEmoji.unifiedToHTML(html));
        });

        var is_agent = "{$Think.get.is_agent}";
        $('#is_agent'+is_agent).attr('selected','selected')
    })
</script>
{/block}




